﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System.IO;
using Skyhook.Core;
using Skyhook.Core.Graphics;

namespace Skyhook.Resources
{
    public class Font : Resource
    {
        SpriteFont XNASpriteFont = null;

        string Name = "NULL_RESOURCE";

        public Font()
        {
        }

        public override bool IsEmpty
        {
            get
            {
                return (XNASpriteFont == null);
            }
        }

        public override string UID
        {
            get
            {
                return Name;
            }
        }

        public int LineSpacing
        {
            get
            {
                return XNASpriteFont.LineSpacing;
            }
        }

        public Vector2 MeasureString(string text)
        {
            return XNASpriteFont.MeasureString(text);
        }

        internal override void LoadFromFile(string assetname)
        {
            XNASpriteFont = GraphicsFactory.CreateSpriteFontFromFile(assetname);
            
            Name = assetname;
        }

        public static implicit operator SpriteFont(Font font)
        {
            return font.XNASpriteFont;
        }
    }
}
